<template>
    <div class="components-container">
        <div class="header-form">
            <div class="layui-inline">
                <label class="layui-form-label" >物品名称</label>
                <div class="layui-input-inline">
                    <el-input  v-model="DPGNAME" placeholder="请输入物品名称"></el-input>
                </div>
            </div>
            <el-button type="primary"  @click="btnSearch" >搜索</el-button>
            <el-button  @click="btnRepeat">重置</el-button>
        </div>
        <div style="height:56px">
            <ul class="toolList">
                <li v-if="btnShow(item.BTNVALUE)" v-for="(item, index) in $store.state.btnListCommon" @click="operate(item.BTNVALUE)">
                  <el-button type="primary" :value="item.BTNSHOWNAME" v-text="item.BTNSHOWNAME"></el-button>
                </li>
                <li>
                  <el-button type="primary" :disabled="this.$store.state.isloading" @click="exportExcel">导出Excel</el-button>
                </li>
            </ul>
        </div>
        <dataTable :headList="headList" :dataList="dataList" :hiddenPageOrder="false" :pageOrder="pageOrder" @pageChange="pageChange" @selectRow="selectRow" :hiddenColumn="hiddenColumn"></dataTable>
    </div>
</template>

<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
.el-button + .el-button {
  margin-left: 0;
}
.btnCenter {
  text-align: center;
}
</style>
<script>
import sweetModal from "@/components/sweetModal";
import dataTable from "@/components/Table/DataTable";
import apiBase from "@/api/apiBase.js";
import { formatDate, timeStringToDate } from "@/utils/date.js";
import { manage } from "@/mixins/managePage.js";
import { ORDER } from "@/const/orderConst.js";
import { PRINT } from "@/components/Pdf/PDF.js";
import informationRegistrationVue from '../jointPlatform/informationRegistration.vue';

export default {
  name: "arehousingManage",
  mixins: [manage],
  data() {
    return {
        DPGNAME: null,
        strType: '4',
        hiddenColumn: false,
        message: 0,
    };
  },
  methods: {
    exportExcel() {
      var header = '库存汇总表'
      if (this.dataList === null){
          this.$message.error("无导出数据！");
          return;
      }
      this.downloadLoading = true;
      require.ensure([], () => {
        const { export_json_to_excel } = require("@/vendor/Export2Excel");
        export_json_to_excel(this.headList, this.OutDataExcel, header);
        this.downloadLoading = false;
      });
    },
    //获取收费信息
    getData() {
        let data = {
            DPGNAME: this.DPGNAME
        };
        apiBase.DoService(data, apiBase.getApiAdress().Depot.QuerySumInvAsh, res => {
            this.dataList = res.data.content;
            // this.pageOrder.totalNum = res.data.content.RecordCount;
        });
    },
    //获取表头
    getheaderlist(){
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Column.GetInventorySummaryColumns,
        res => {
          this.headList = res.data.content;
        }
      )
    },
    btnRepeat(){
        this.DPGNAME = null;
        this.getData();
    }
    
  },
  components: {
    sweetModal,
    dataTable,
  },
  activated() {
    this.getData();
  },
  mounted() {
  },
  created() {
    this.getheaderlist();
  },
};
</script>

